Compression of image data in a computerized system allows the system to store more image data in the same amount of storage space. Typically, such compression involves removing redundant information from the image data. In a lossless compression scheme, the redundant information is removed in a way that, upon decompression of the compressed image, the original image is restored in full.
A computerized system may achieve lossless compression of color image data by applying a prediction model (e.g., inter-component prediction) to each color component of the image data and an arithmetic coding scheme to a prediction error, i.e., a deviation of the prediction model from the image data. The arithmetic coding scheme expresses the prediction error at each pixel using a set of symbols (e.g., binary words). The computerized system compresses the prediction error by retaining only those symbols that have the highest frequency of occurrence in the image data. In applying the arithmetic coding scheme to the prediction error, the computerized system applies a set of context models, each of which dictate a different approach to computing a frequency distribution for the set of symbols at each pixel.